<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>重庆大学硕士研究生服务系统</title>
<?php $this->load->view('includes/ga_head'); ?>  
</head>
<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> 
<body class=""> 
<!--<![endif]-->
<?php $this->load->view('includes/ga_navbar'); ?>  
<?php $this->load->view('includes/ga_sidebar'); ?>  
<div class="content">
    <div class="header">
        <h1 class="page-title">用户列表</h1>
    </div>
    <ul class="breadcrumb">
        <li><a href="index.html">Home</a> <span class="divider">/</span></li>
        <li class="active">用户列表</li>
    </ul>
    <div class="container-fluid">
        <div class="row-fluid">
<?php $this->load->view('includes/ga_message'); ?>  
<?php echo form_open(current_url());	?>
<div class="input-append">
<input type="text" class="span2 search-query" id="search" name="search_query" value="<?php echo set_value('search_query',$search_key_words);?>">
<select name="select_u_group">
  <option value="all">所有</option>
 	<?php foreach ($user_groups as $u_group) { ?>
	<option value = <?php echo $u_group['ugrp_id']; ?> <?php echo ($u_group['ugrp_id']==$select_u_group)?'selected':''; 
		?> ><?php echo $u_group['ugrp_name']; ?></option>
	<?php } ?>
</select>
<input type="submit" name="search_user" class="btn" value="搜索" />
<a class="btn" href="<?php echo $base_url; ?>gass_auth_teachers/manage_user_accounts">重设</a>
</div>
<?php echo form_close();?>	
<div class="well">
<?php $attributes = array('id' => 'user_list_form');echo form_open(current_url(), $attributes);?>  	
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
  	    <th>Email</th>
		<th>用户名</th>
		<th>角色</th>
		<th>权限</th>
		<th>吊销账户</th>
		<th>删除账户</th>
                    </tr>
                </thead>
                <?php if (!empty($users)) { ?>
                <tbody>
                    <?php foreach ($users as $user) { ?>
                    <tr>
                        <td>
						<a href="<?php echo $base_url.'gass_auth_teachers/update_user_account/'.$user[$this->flexi_auth->db_column('user_acc', 'id')];?>">
						<?php echo $user[$this->flexi_auth->db_column('user_acc', 'email')];?>
                        </a>
                        </td>
                        <td>
							<?php echo $user['uacc_username'];?>
                        </td>
                        <td>
							<?php echo $user[$this->flexi_auth->db_column('user_group', 'name')];?>
                        </td>
                        <td>
							<a href="<?php echo $base_url.'gass_auth_teachers/update_user_privileges/'.$user[$this->flexi_auth->db_column('user_acc', 'id')];?>">Manage</a>
                        </td>
                        <td>
                            <input type="hidden" name="current_status[<?php echo $user[$this->flexi_auth->db_column('user_acc', 'id')];?>]" value="<?php echo $user[$this->flexi_auth->db_column('user_acc', 'suspend')];?>"/>
                            <!-- A hidden 'suspend_status[]' input is included to detect unchecked checkboxes on submit -->
                            <input type="hidden" name="suspend_status[<?php echo $user[$this->flexi_auth->db_column('user_acc', 'id')];?>]" value="0"/>
                        
                            <input type="checkbox" name="suspend_status[<?php echo $user[$this->flexi_auth->db_column('user_acc', 'id')];?>]" value="1" <?php echo ($user[$this->flexi_auth->db_column('user_acc', 'suspend')] == 1) ? 'checked="checked"' : "";?>/>
                        </td>
                        <td>
                            <input type="checkbox" name="delete_user[<?php echo $user[$this->flexi_auth->db_column('user_acc', 'id')];?>]" value="1"/>
                        </td>
                    </tr>
                <?php } ?>
                </tbody>	<TFOOT>
      <TR>
         <TD colSpan=5><?php if (! empty($pagination['links'])) { ?>
               总数: 共 <?php echo $pagination['total_users'];?> 条查询结果
               链接: <?php echo $pagination['links'];?>
               <?php } ?>
         </TD> 
         <td colSpan=1>
  <button type="submit" class="btn" id="del_btn" /><i class="icon-remove"></i> 更改/删除用户 
  </button>
  <input type="hidden" value="1" name="update_users"/>
         </td>
      </TR>
    </TFOOT>
            <?php } else { ?>
                <tbody>
                    <tr>
                        <td colspan="7">
                            No users are available.
                        </td>
                    </tr>
                </tbody>
            <?php } ?>
            </table>
            <?php echo form_close();?>
                
</div>
<?php $this->load->view('includes/ga_footer'); ?>  
        </div>
    </div>
</div>
<?php $this->load->view('includes/ga_scripts'); ?>
<script>
$(document).ready(function(){
    $('#del_btn').confirm({
		'title' : '更改/删除用户',
		'message' : '您确定要更改/删除该用户吗,请谨慎操作？!',        
		'action' : function() {
			$('#user_list_form').submit();
		}
	});
});
</script>  
  
</body>
</html>
